package cn.wxq.daily.empdailymgforserve.service.impl;

import cn.wxq.daily.empdailymgforserve.domain.Reimbursement;
import cn.wxq.daily.empdailymgforserve.mapper.ReimbursementDao;
import cn.wxq.daily.empdailymgforserve.service.ReimbursementService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

/**
 * 费用报销
 */
@Service
public class ReimbursementServiceImpl implements ReimbursementService{

    @Autowired
    private ReimbursementDao reimbursementDao;
    /**
     * 条件查询
     * @param reimbursement
     * @return
     */
    @Override
    public List<Reimbursement> findByPage(Reimbursement reimbursement) {
        return reimbursementDao.findByPage(reimbursement);
    }

    /**
     * 新增
     * @param reimbursement
     * @return
     */
    @Override
    public int insertReimbursement(Reimbursement reimbursement) {
        reimbursement.setAddTime(new Date());
        reimbursement.setReimStatus("2");
        return reimbursementDao.insertReimbursement(reimbursement);
    }

    /**
     * 修改
     * @param reimbursement
     * @return
     */
    @Override
    public int updateReimbursement(Reimbursement reimbursement) {
        return reimbursementDao.updateReimbursement(reimbursement);
    }

    /**
     * 删除
     * @param reimId
     * @return
     */
    @Override
    public int deleteById(Integer reimId) {
        return reimbursementDao.deleteById(reimId);
    }

    /**
     * id查询详情
     * @param reimId
     * @return
     */
    @Override
    public Reimbursement selectReimbursementById(Integer reimId) {
        return reimbursementDao.selectReimbursementById(reimId);
    }
}
